home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / QuickTime / Programming Stuff / Documentation / develop articles / develop Issue 24 / Printing Compressed Images / PrintPICTtoJPEG / PrintPictToJPEG.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-17  |  2.3 KB  |  101 lines  |  [TEXT/MPCC]

  1. #ifndef __PRINTPICTTOJPEG__
  2. #define __PRINTPICTTOJPEG__
  3.  
  4. #include <ImageCompression.h>
  5.  
  6. struct PICTImage {
  7.     PicHandle    theData;                    /*the PICT Data Handle*/
  8.     Rect    theBounds;                        /* the Bounds of the Image */    
  9.     ImageDescriptionHandle theDesc;            /* an ImageDescriptionHandle */
  10. };
  11. typedef struct PICTImage PICTImage;
  12.  
  13. // macro for determining if the port is a color port.
  14. #define ISCOLORPORT(gPort) (((gPort)->portBits.rowBytes & 0x8000) != 0)
  15.  
  16.  
  17. //=====================================================================================
  18. // Public interface function prototypes
  19. //=====================================================================================
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. static OSErr ReadPICTData(FSSpec *theSpec, Handle *theData);
  26.  
  27. static OSErr SetPICTBounds(PICTImage *thePICTImage);
  28.  
  29. // DrawPICTImage -- draws the PICT image the current port
  30. static OSErr DrawBitImage(GWorldPtr theGWorld, Rect *bounds, Boolean doCompression);
  31.  
  32. SInt16 main(void);
  33. static SInt16 initMacintosh(void);
  34. static OSErr SetupMenus(void);
  35. static SInt16 handleEvent(void);
  36.  
  37. static OSErr Print(PICTImage thePICTImage, THPrint aPrintRecordHandle);
  38.  
  39. static void DoKeyDown(EventRecord *);
  40. static void doCommand(SInt16,SInt16);
  41. static void showAboutMeDialog(void) ;
  42. static void DoTheOpenCommand(void);
  43.  
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47.  
  48. /*
  49.  * Resource ID constants.
  50. */
  51.  
  52.  
  53. #define kAppleMenuID             128   /* This identifies the apple menu*/
  54. #define kFileMenuID                129
  55. #define kEditMenuID                130
  56. #define kImageCompressionMenuID    131
  57.  
  58. /* Menu item numbers */
  59. /* Apple Menu */
  60. #define kAboutMeCommand  1  
  61.  
  62. /* File Menu */
  63. #define kOpenCommand        1
  64. #define kSaveCommand        2
  65. // separator line            3
  66. #define kPageSetupCommand    4
  67. #define kPrintCommand        5
  68. // separator line            6
  69. #define kQuitCommand        7
  70.  
  71. /* Compression Settings Menu */
  72. #define kDoImageCompression         1
  73.  
  74. /*
  75.  * Support for the About Dialog
  76.  */
  77. #define    kAboutMeDLOG    128
  78. #define    kOKButton        1
  79.  
  80. // alert dialog ID to report problems to users.
  81. #define kGenericError         128
  82.  
  83. // define for flags to StdPix bottleneck.
  84. #define kCallOldBits        (1 << 0)  
  85. #define kCallStdBits        (1 << 1)  
  86.  
  87. #define MIN(x,y)  ( x  >  y  ) ?  y  :  x 
  88.  
  89. #define kSleepTime  5
  90.  
  91. #define kInsetBits 40
  92. #define kWithCompression true
  93. #define kNoCompression false
  94. #define kPICTHeaderSize 512
  95.  
  96. // Application Specific Errors
  97. #define kAppError                 4017
  98. #define kCouldntLoadMenu         4018
  99.  
  100. #endif
  101.